// 1. 引入异步对象
import request from '@/utils/request'
// 2. 使用枚举存储接口地址
enum Api {
  getAttrListApi = '/admin/product/attrInfoList',
  deleteAttrDataApi = '/admin/product/deleteAttr',
  addOrUpdateAttrApi = '/admin/product/saveAttrInfo'
}
// 3. 书写接口函数

/**
 * 定义了一个根据三级导航Id获取属性列表的接口函数
 * @param attrId 
 * @returns 
 */
// 3. 书写接口函数
export const reqGetAttrListData = ({category1Id,category2Id,category3Id}:any) => {
  return request.get<any,any>(Api.getAttrListApi+`/${category1Id}/${category2Id}/${category3Id}`)
 }


//  删除数据
export const reqDeleteAttrListData = (attrId:number)=>{
  return request.delete<any,any>(`${Api.deleteAttrDataApi}/` + attrId)
}

// 添加属性
export const reqAddOrUpdateAttrInfo= (attrId:any) => {
  return request.post<any,any>(Api.addOrUpdateAttrApi, attrId)
}

